﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace Honestysoft.Financing.WebUI.Module.Audit.JSON
{
    /// <summary>
    /// GetLikeContract 的摘要说明
    /// </summary>
    public class GetLikeContract : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type = context.Request.Params["type"];
            string val = context.Request.Params["val"];
            Honestysoft.Financing.BusinessLogic.Contract bll = new BusinessLogic.Contract("");
            DataTable dt = null;
            if (type == "0")
            {
                dt = bll.GetLikeContractByName(val);
            }
            else
            {
                dt = bll.GetLikeContractByPrice(Convert.ToDecimal(val));
            }
            string responseData = ""; 
            if (dt == null || dt.Rows.Count == 0)
            {
                responseData = "";
            }
            else
            {
                responseData = "1";
            }
            context.Response.Write(responseData);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}